<?php
class Pageley_Domain_Validator_Timestamp extends Pageley_Domain_Validator_Abstract {
	
	private $notATimestampMessage = "error.validation.notATimestamp";
	
	public function validate($value, $propertyName, $object) {
		$errors = new Pageley_Util_ArrayMap();
		if($value !== null && $value !== "") {
            $notATimestamp = $this->rejectIfFalse($value instanceof Pageley_Util_Timestamp, $this->notATimestampMessage, array("{field." . $propertyName . "}", $value));
    		if($notATimestamp) {
    			$errors->put($propertyName, $notATimestamp);
    		}
        }
		return $errors;
	}
	
	public function setNotATimestampMessage($notATimestampMessage) {
		$this->notATimestampMessage = $notATimestampMessage;
	}
}